-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UI update a file #63
UI update a file #63
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added some comments
...src/main/java/com/omh/android/storage/sample/presentation/file_viewer/FileViewerViewModel.kt
Outdated
Show resolved
Hide resolved
...src/main/java/com/omh/android/storage/sample/presentation/file_viewer/FileViewerViewModel.kt
Outdated
Show resolved
Hide resolved
c5aa49b
to
feb0578
Compare
679d96a
to
72e73d1
Compare
4f8e7bb
to
addb88f
Compare
addb88f
to
36a1682
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed yesterday via teams, currently this doesn't have the expected behavior. Waiting for new changes
95b9776
to
bc270c7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some comments
.../src/main/java/com/omh/android/storage/sample/presentation/file_viewer/FileViewerActivity.kt
Outdated
Show resolved
Hide resolved
.../src/main/java/com/omh/android/storage/sample/presentation/file_viewer/FileViewerActivity.kt
Outdated
Show resolved
Hide resolved
.../src/main/java/com/omh/android/storage/sample/presentation/file_viewer/FileViewerActivity.kt
Outdated
Show resolved
Hide resolved
.../src/main/java/com/omh/android/storage/sample/presentation/file_viewer/FileViewerActivity.kt
Outdated
Show resolved
Hide resolved
@@ -55,8 +55,10 @@ class FileViewerViewModel @Inject constructor( | |||
is FileViewerViewEvent.CreateFile -> createFileEvent(event) | |||
is FileViewerViewEvent.DeleteFile -> deleteFileEvent(event) | |||
is FileViewerViewEvent.UploadFile -> uploadFile(event) | |||
is FileViewerViewEvent.UpdateFile -> updateFile(event) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please move this below is FileViewerViewEvent.UpdateFileClicked -> updateFileClicked(event)
(line 61)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is neccesary to move below?
@@ -110,14 +112,14 @@ class FileViewerViewModel @Inject constructor( | |||
} | |||
|
|||
private fun downloadFileEvent() { | |||
setState(FileViewerViewState.Loading) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why we moved this?
user should see a loading screen once we start to execute any logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because if the file is not downloadable, the file will not be downloadable then the loading state won't be dismissed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can dismiss it dispatching a refresh event:
setState(FileViewerViewState.Loading)
if (!file.isDownloadable()) {
toastMessage.postValue("${file.name} is not downloadable")
refreshFileListEvent()
return
}
private fun updateFile(event: FileViewerViewEvent.UpdateFile) { | ||
val fileId = lastFileClicked?.id ?: return | ||
|
||
setState(FileViewerViewState.Loading) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please move this below method declaration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you move below the method declaration, the state loading will be there if the lastFileClicked is null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above, call refresh method
...src/main/java/com/omh/android/storage/sample/presentation/file_viewer/FileViewerViewModel.kt
Outdated
Show resolved
Hide resolved
@@ -137,6 +139,35 @@ class FileViewerViewModel @Inject constructor( | |||
} | |||
} | |||
|
|||
private fun updateFile(event: FileViewerViewEvent.UpdateFile) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please rename this as updateFileEvent
...src/main/java/com/omh/android/storage/sample/presentation/file_viewer/FileViewerViewState.kt
Outdated
Show resolved
Hide resolved
bc270c7
to
53c92a6
Compare
53c92a6
to
4e835c8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
...src/main/java/com/omh/android/storage/sample/presentation/file_viewer/FileViewerViewEvent.kt
Outdated
Show resolved
Hide resolved
@@ -110,14 +112,14 @@ class FileViewerViewModel @Inject constructor( | |||
} | |||
|
|||
private fun downloadFileEvent() { | |||
setState(FileViewerViewState.Loading) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can dismiss it dispatching a refresh event:
setState(FileViewerViewState.Loading)
if (!file.isDownloadable()) {
toastMessage.postValue("${file.name} is not downloadable")
refreshFileListEvent()
return
}
private fun updateFile(event: FileViewerViewEvent.UpdateFile) { | ||
val fileId = lastFileClicked?.id ?: return | ||
|
||
setState(FileViewerViewState.Loading) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above, call refresh method
Depends on PR #61. Once the 'state/updateNonGms' branch is merged, change the base base branch to 'develop'.
Implement the UI to update a file.
ui-upload-file.mov